<%-- 
    Document   : list users
    Created on : 11 janv. 2015, 17:39:13
    Author     : Killian
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><s:text name="listusers.titre1"/></title>
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
        <link href="css/styles.css" rel="stylesheet" type="text/css">
    </head>
    <body>
        <header>
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="accueil"><s:text name="accueil.titleNavBar"/></a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
                                    <s:text name='menu.adresses'/> <span class="caret"></span>
                                </a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="listAddress"><s:text name="menu.listeAdresses"/></a></li>
                                    <li><a href="<s:url action="ajout_ip"/>"><s:text name='menu.ajoutAdresse'/></a></li>
                                </ul>
                            </li>
                            <s:if test="%{#session.droit == 'admin'}">
                                <li class="dropdown">
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false">
                                        <s:text name='menu.utilisateurs'/> <span class="caret"></span>
                                    </a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li class="active"><a href="#"><s:text name="menu.listeUtilisateurs"/><span class="sr-only">(current)</span></a></li>                  
                                        <li><a href="<s:url action="inscription"/>"><s:text name='menu.ajoutUser'/></a></li>
                                    </ul>
                                </li>
                            </s:if>
                            <li><a href="apropos"><s:text name="menu.aPropos"/></a></li>
                        </ul>                  
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><s:text name="accueil.profil"/><strong><s:property value="%{#session.user.identifiant}"/></strong><span class="caret"></span></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li>
                                        <s:url id="profil" action="profil">
                                            <s:param name="id_user" value="%{#session.user.id_user}"></s:param>                
                                        </s:url>
                                        <s:a href="%{profil}"><s:text name="accueil.myprofil"/></s:a>
                                    </li>
                                    <li>
                                        <s:url id="editProfil" action="editProfil">
                                            <s:param name="id_user" value="%{#session.user.id_user}"></s:param>                
                                        </s:url>
                                        <s:a href="%{editProfil}"><s:text name="accueil.modifierProfil"/></s:a>
                                    </li>
                                    <li class="divider"></li>
                                    <li><a href="logout"><s:text name="accueil.deconnexion"/></a></li>
                                </ul>
                            </li>
                        </ul>
                        
                    </div><!-- /.navbar-collapse -->
                    
                </div><!-- /.container-fluid -->
            </nav>
        </header>
        <section>
            <article>
                <div class="page-header">
                    <h1><s:text name="listusers.titre1"/></h1>                   
                </div>
                <s:if test="hasActionMessages()">
                    <div class="welcome">
                       <s:actionmessage/>
                    </div>
                </s:if>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div style="text-align: right;">
                            <a id="addUser" class="btn btn-primary" href="<s:url action="inscription"/>"><s:text name='listusers.ajoutUser'/></a>                
                        </div>
                        <table class="table">
                            <thead>
                                <tr>
                                    <th><s:text name="listusers.identifiant"/></th>
                                    <th><s:text name="listusers.mail"/></th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <s:iterator value="listUser">
                                    <tr>
                                            <td><s:property value="identifiant" /></td>
                                            <td><s:property value="mail" /></td>
                                            <td>
                                                <s:url id="deleteUser" action="deleteUser">
                                                    <s:param name="id_user" value="%{id_user}"></s:param>                
                                                </s:url>
                                                <s:a href="%{deleteUser}" role="button" onclick="javascript: return confirm('Etes-vous sûr de vouloir supprimer cet utilisateur ?');" cssClass="btn btn-danger btn_action"><img src="img/supprimer.png" class="action_adress" alt="poubelle_supprimer" width="22" height="22"></s:a>
                                            </td>
                                            
                                    </tr>                                   
                                </s:iterator>     
                            </tbody>
                        </table>
                    </div>
                    <div class="panel-footer">
                    </div>
                </div>
            </article>
        </section>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
    </body>
</html>
